package com.xyh.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 分页返回结果
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class PageResult {
    /**
     * 当前页码
     */
    private int pageNum;
    /**
     * 每页数量
     */
    private int pageSize;
    /**
     * 记录总数
     */
    private long totalSize;
    /**
     * 页码总数
     */
    private long totalPages;
    /**
     * 数据模型
     */
    private List<?> content;
    private boolean first=false;
    private boolean last=false;

    public PageResult(int pageNum, int pageSize, long totalSize, long totalPages, List<?> content) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalSize = totalSize;
        this.totalPages = totalPages;
        this.content = content;
        if (pageNum>=totalPages){
            this.last = true;
        }
        if (pageNum==1){
            this.first = true;
        }
    }
}